﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Edu.Web.Data.DV;
using Edu.Web.Data.Entity;

namespace Edu.Web.Data.DAO.Impl
{
    public partial class EvaluateDAO
    {
        public IQueryable<Evaluate4TeacherDV> GetListByTeacherId(long teacherId)
        {
            return from ev in Db.Set<EvaluateEntity>()
                   join stu in Db.Set<StudentEntity>() on ev.StuUserId equals stu.UserId
                   join user in Db.Set<UserEntity>() on stu.UserId equals user.Id
                   join clazz in Db.Set<ClazzEntity>() on ev.ClazzId equals clazz.Id
                   where ev.TeacherUserId == teacherId
                   orderby ev.CreateTime descending
                   select new Evaluate4TeacherDV
                   {
                       Amount = ev.Amount,
                       ClazzId = ev.ClazzId,
                       ClazzName = clazz.ClazzName,
                       CreateTime = ev.CreateTime,
                       EvalType = ev.EvalType,
                       EvaluateId = ev.Id,
                       Remark = ev.Remark,
                       StuId = stu.Id,
                       StuNo = stu.StuNo,
                       StuRealName = user.RealName
                   };
        }
    }
}